home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
fortran
/
fatdos.zip
/
FATD1.DOC
< prev
next >
Wrap
Text File
|
1988-04-15
|
24KB
|
951 lines
FAT-DOS 1.0 ALLMEM PAGE A-1
ALLMEM - Allocates memory dynamically at run-time.
integer*2 Npar,Seg,Maxpar
call AllMem(Npar,Seg,Maxpar)
call with:
Npar - Number of Paragraphs(16 bytes) to allocate.
returns:
Seg - Segment address of 1st paragraph, or an error code.
Error Code: 7 - memory control blocks destroyed.
8 - insufficient memory.
Maxpar - Maximum number of available paragraphs, if allocation
failed, otherwise the actual number of paragraphs allocated.
example: Npar = 10
call AllMem(Npar,Seg,Maxpar)
if(Seg .eq.7 .or. Seg.eq.8)go to 1000
FREMEM - Free memory allocated via AllMem.
integer*2 Seg,Ierr
call FreMem(Seg,Ierr)
call with:
Seg - Starting paragraph of memory block allocated with AllMem.
returns:
Ierr - Error code = 0 -safe return, memory free'd
7 -memory control blocks destroyed
9 -incorrect segement address
example:
NPAR = 16
call ALLMEM(NPAR,SEG,MAXPAR)
if(SEG.eq.7.or.SEG.eq.8)go to 900
call pokeb(Int2(0),Seg,Value)
.
.
call FREMEM(SEG,IERR)
if(IERR.ne.0)go to 1000
FAT-DOS 1.0 MODMEM PAGE A-2
MODMEM - Modify size of previously allocated memory block.
integer*2 NPAR,SEG,MAXSEG,IERR
call MODMEM(NPAR,SEG,MAXPAR,IERR)
call with:
NPAR = desired modified memory size in paragraphs
SEG = seg of current memory block
returns:
MAXPAR = maximum no. of paragraphs available(if error)
IER = 7 memory control blocks destroyed
= 8 insufficent memeory
= 9 incorrect seg
example: NPAR = 512
call ALLMEM(NPAR,SEG,MAXPAR)
.
.
NPAR = 16
call MODMEM(NPAR,SEG,MAXPAR,IERR)
PEEKB - Get a byte value from memory.
integer*2 OFF,SEG,VALUE
call PEEKB(OFF,SEG,VALUE)
call with:
OFF - offset value from start of segment, <=64k
SEG - segment value of byte location, <=64k
returns:
VALUE - the byte value is stored in the lower byte of the
integer*2 value and the high byte is zeroed.
example:
call PEEKB(Int2(0),Int2(#B800),VALUE)
This call returns the ascii value of the character stored
in the 1st byte of the CGA adapter memory, at row 0, col 0
of the screen.
Notes: An integer*2 is signed and may range from -32k to +32k.
If the segment or offset values exceed this amount you should
declare the segment and offset as integer*4.
i.e.
integer*4 SEG,OFF
integer*2 VALUE
SEG = #B800 <--- .gt. 32k
OFF = 0
call PEEKB(OFF,SEG,VALUE)
FAT-DOS 1.0 PEEKW PAGE A-3
PEEKW - Get a word value from memory.
integer*2 OFF,SEG,VALUE
call PEEKW(OFF,SEG,VALUE)
call with:
OFF - offset value from start of segment, <=64k
SEG - segment value of word location, <=64k
returns:
VALUE - the word value is returned in this argument.
example:
call PEEKW(Int2(0),Int2(#0800),VALUE)
This call returns word stored at SEG= Hex 0800, OFF=0.
Notes: An integer*2 is signed and may range from -32k to +32k.
If the segment or offset values exceed this amount you should
declare the segment and offset as integer*4.
i.e.
integer*4 SEG,OFF
integer*2 VALUE
SEG = #B800 <--- .gt. 32k
OFF = 0
call PEEKW(OFF,SEG,VALUE)
PEEKL - Get a Long word value from memory.
integer*2 OFF,SEG
integer*4 VALUE
call PEEKL(OFF,SEG,VALUE)
call with:
OFF - offset value from start of segment, <=64k
SEG - segment value of long word location, <=64k
returns:
VALUE - the long word value is returned in this argument.
example:
call PEEKL(0,#0800,VALUE)
This call returns long word stored at SEG= Hex 0800, OFF=0.
Notes: An integer*2 is signed and may range from -32k to +32k.
If the segment or offset values exceed this amount you should
declare the segment and offset as integer*4.
i.e.
integer*4 SEG,OFF
integer*4 VALUE
SEG = #B800 <--- .gt. 32k
OFF = 0
call PEEKL(OFF,SEG,VALUE)
FAT-DOS 1.0 POKEB PAGE A-4
POKEB - Store a byte value in memory.
integer*2 OFF,SEG,VALUE
call POKEB(OFF,SEG,VALUE)
call with:
OFF - offset value from start of segment, <=64k
SEG - segment value of byte location, <=64k
VALUE - the byte value to store.
returns:
nothing
example: VALUE = ICHAR('A')
call POKEB(Int2(0),Int2(#B800),VALUE)
This call stores the ascii value of the character 'A'
in the 1st word of the CGA adapter memory, at row 0, col 0
of the screen.
Notes: An integer*2 is signed and may range from -32k to +32k.
If the segment or offset values exceed this amount you should
declare the segment and offset as integer*4.
i.e.
integer*4 SEG,OFF
integer*2 VALUE
SEG = #B800 <--- .gt. 32k
OFF = 0
call POKEB(OFF,SEG,VALUE)
POKEW - Store a word value in memory.
integer*2 OFF,SEG,VALUE
call POKEW(OFF,SEG,VALUE)
call with:
OFF - offset value from start of segment, <=64k
SEG - segment value of word location, <=64k
VALUE - the word value to store.
returns:
nothing
example: VALUE = 128
call POKEW(Int2(0),Int2(#0800),VALUE)
This call stores the value 128 at SEG=Hex 0800, OFF = 0.
Notes: An integer*2 is signed and may be range from -32k to +32k.
If the segment or offset values exceed this amount you should
declare the segment and offset as integer*4.
i.e.
integer*4 SEG,OFF
integer*2 VALUE
SEG = #B800 <--- .gt. 32k
OFF = 0
call POKEW(OFF,SEG,VALUE)
FAT-DOS 1.0 POKEL PAGE A-5
POKEL - Store a long word value in memory.
integer*2 OFF,SEG
integer*4 VALUE
call POKEL(OFF,SEG,VALUE)
call with:
OFF - offset value from start of segment, <=64k
SEG - segment value of long word location, <=64k
VALUE - the long word value to store.
returns:
nothing
example: VALUE = 128
call POKEL(Int2(0),Int2(#0800),VALUE)
This call stores the value 128 at SEG=Hex 0800, OFF = 0.
Notes: An integer*2 is signed and may be range from -32k to +32k.
If the segment or offset values exceed this amount you should
declare the segment and offset as integer*4.
i.e.
integer*4 SEG,OFF
integer*4 VALUE
SEG = #B800 <--- .gt. 32k
OFF = 0
call POKEL(OFF,SEG,VALUE)
FAT-DOS 1.0 OPFILX PAGE B-1
OPFILX - Open an existing file, using the File Handle method.
The Ier variable should be checked after a call to
OpFilx() to be sure a valid Handle has been returnd.
character*n File
integer*2 Mode,Handle,Ier
call OpFilx(File,Mode,Handle,Ier)
call with:
File = 'Name'//char(0), Asciiz string
MODE = 0 read
= 1 write
= 2 read/write
returns:
HANDLE= file handle
IER = 0 normal return
1 needs file sharing
2 file not found
3 path not found
4 no handle av